﻿using System;
using System.Data;
using System.Text;
using System.Collections.Generic;
using Microsoft.Practices.EnterpriseLibrary.Data;
using Microsoft.Practices.EnterpriseLibrary.Data.Sql;
using System.Data.Common;

namespace Chenxin.Lib.Hr.DAL
{
    /// <summary>
    /// 数据访问类Hr_Contacts。
    /// </summary>
    public class Hr_Post_Office
    {
        public Hr_Post_Office()
        { }
        #region  成员方法



        /// <summary>
        /// 执行sql
        /// </summary>
        public static int ExecSql(string sql)
        {
            Database db = DatabaseFactory.CreateDatabase("Chenxin_Main");
            DbCommand dbCommand = db.GetSqlStringCommand(sql);
            return db.ExecuteNonQuery(dbCommand);
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public static DataSet GetList(string strSelect,string tableName ,string strWhere, string strOrder, int intCurPage, int intRowCnt)
        {
            Database db = DatabaseFactory.CreateDatabase("Chenxin_Main_Search");
            DbCommand dbCommand = db.GetStoredProcCommand("PagerMultiTable");
            db.AddInParameter(dbCommand, "PageIndex", DbType.Int32, intCurPage);
            db.AddInParameter(dbCommand, "PageSize", DbType.Int32, intRowCnt);
            db.AddInParameter(dbCommand, "OrderField", DbType.AnsiString, strOrder);
            db.AddInParameter(dbCommand, "TableName", DbType.AnsiString, tableName);
            db.AddInParameter(dbCommand, "StrWhere", DbType.AnsiString, strWhere);
            db.AddInParameter(dbCommand, "FieldList", DbType.AnsiString, strSelect);
            //db.AddInParameter(dbCommand, "TableFieldList", DbType.AnsiString, TableFieldList);
            //db.AddInParameter(dbCommand, "DoCount", DbType.Boolean, DoCount);
            return db.ExecuteDataSet(dbCommand);
        }

        #endregion  成员方法
    }
}

